#include "stdafx.h"
#include "Record.h"
#include "File\RecordContainer.h"



CRecord::CRecord()
{	
	mSize  = 0;
	mStatus  = RDS_VIRGIN;
	mOwner  = 0;
	mContainer  = NULL;
}


CRecord::CRecord(CRecord* pRecord)
{
	int hour  = (pRecord->mBeginTime.GetHour() /SPAN_RECORD_SPAN) *SPAN_RECORD_SPAN;

	mBeginTime  = CTime(pRecord->mBeginTime.GetYear(), pRecord->mBeginTime.GetMonth(), 
					pRecord->mBeginTime.GetDay(),hour, 0, 0);
	/*mEndTime  = mBeginTime + CTimeSpan(0, 2, 0, 0);*/
	mEndTime  = mBeginTime + CTimeSpan(0, SPAN_RECORD_SPAN , 0, 0);
	mOwner  = pRecord->mOwner;
	mSize   = pRecord->mSize;
	mStatus = pRecord->mStatus;
	mType   = pRecord->mType;
	mContainer  = NULL;
}


CRecord::~CRecord()
{
}



void CRecord::Fuck()
{
	if (mStatus == RDS_VIRGIN) {
		mStatus  = RDS_NORMAL;
	}
}


void CRecord::PrintSpan(char* prefix)
{
	if(prefix != NULL)
		Print("%s %S  %S", prefix, mBeginTime.Format( _T("%Y-%m-%d  %H:%M:%S") ), mEndTime.Format(_T("%Y-%m-%d  %H:%M:%S")));
	else
		Print("%s %S  %S", prefix, mBeginTime.Format(_T("%Y-%m-%d  %H:%M:%S")), mEndTime.Format(_T("%Y-%m-%d  %H:%M:%S")));
}
